import os
from dotenv import load_dotenv, find_dotenv
from zhipuai import ZhipuAI

_ = load_dotenv(find_dotenv())

api_key = os.environ.get('ZHIPU_API_KEY')
if api_key is None:
    raise ValueError("API Key is not set in the .env file")


client = ZhipuAI(api_key=api_key)

response = client.embeddings.create(
    model="embedding-2", 
    input="你好",
)

print(len(response.data[0].embedding))
print(response)